using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GauntletFramework
{
    public static class Rand
    {
        static Random Random = new Random();

        public static int Next() { return Random.Next(); }
        public static int Next(int maxValue) { return Random.Next(maxValue + 1); }
        public static int Next(int minValue, int maxValue) { return Random.Next(minValue, maxValue + 1); }
        public static void NextBytes(byte[] buffer) { Random.NextBytes(buffer); }

        public static double NextDouble() { return Random.NextDouble(); }

        ////////////////////////////////////////////////////////////////////////////////////////////////

        public static void ChangeNumber(ref int Number, int minValue, int maxValue)
        {
            if (minValue >= maxValue)
                Number = minValue;
            else
            {
                int Step = 0;
                int NewNumber = Number;
                while (NewNumber == Number && Step < 20)
                {
                    NewNumber = Next(minValue, maxValue);
                    Step++;
                }
                Number = NewNumber;
            }
        }
    }
}
